package org.keyuan.service.impl;

import java.util.List;

import org.hibernate.HibernateException;
import org.keyuan.dao.Dao;
import org.keyuan.service.Service;
import org.keyuan.util.PageUtil;

public  class ServiceSupport<T> implements Service<T> {
	protected Dao<T> dao;

	public boolean delete(Class<T> clazz,Integer id) {
		try{
			return dao.delete(clazz,id);
		}catch(HibernateException e){
			throw e;
		}
	}

	public List<T> getPagingdata(Class<T> entityClass,PageUtil<T> pageUtil) {
		try{
		return dao.getPagingdata(entityClass, pageUtil);
		}catch(HibernateException e){
			throw e;
		}
	}

	public boolean insert(T t) {
		return dao.insert(t);
	}

	public boolean update(T t) {
	   return dao.update(t);
	}

	public T getEntity(Class<T> entity, Integer id) {
		return dao.getEntity(entity, id);
	}
}
